import { RouterModule, Router, Route, Routes, ActivatedRoute } from "@angular/router";
import { NgModule } from "@angular/core";
import { AuthGuardModule, AuthGuardService } from "auth-guard";

import { StockComponent } from "./stock.component";
import { StockChartComponent } from "./stock-chart/stock-chart.component";
import { StockTickComponent } from "./stock-tick/stock-tick.component";
// import { StockFundComponent } from "./stock-fund/stock-fund.component";
import { f10Routes } from "../f10/f10-routing.module";

const stockRoutes: Routes = [{
  path: "stock/:id",
  component: StockComponent,
  canActivateChild: [
    AuthGuardService
  ],
  children: [
    {
      path: "chart",
      component: StockChartComponent
    }, {
      path: "tick",
      component: StockTickComponent
    }, f10Routes, {
      path: "",
      pathMatch: "full",
      redirectTo: "chart"
    }]
}, {
  path: "stock",
  component: StockComponent
  // pathMatch: "full",
  // redirectTo: "stock/000001_SS"
// }, {
//   path: "",
//   pathMatch: "full",
//   redirectTo: "stock/000001_SS"
}];

@NgModule({
  imports: [
    RouterModule.forChild(stockRoutes)
  ],
  exports: [
    RouterModule
  ]
})
export class StockRoutingModule {
  id;
  constructor(private route: ActivatedRoute) {
    this.id = route.params.map((p: any) => p.id);
    console.log(this.id);
  }
}
